package com.jg.service.impl;

import com.jg.dto.ProductParam;
import com.jg.entity.Products;
import com.jg.mapper.ProductsMapper;
import com.jg.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 86130
 * @version 1.0
 * @description: TODO
 * @date 2025/6/24 下午2:57
 */
@Service
public class ProductServiceImpl implements ProductService {
    @Autowired
    ProductsMapper productsMapper;

    @Override
    public List<Products> list(ProductParam productParam) {
        return productsMapper.list(productParam);
    }

    @Override
    public String delete(Integer productId) {
        return productsMapper.delete(productId) > 0 ? "success" : "fail";
    }

    @Override
    public String add(Products products) {
        return productsMapper.add(products) > 0 ? "success" : "fail";
    }

    @Override
    public Products detail(Integer productId) {
        return productsMapper.detail(productId);
    }

    @Override
    public String update(Products products) {
        return productsMapper.update(products) > 0 ? "success" : "fail";
    }
}
